home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / xview_private / ev.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  9.5 KB  |  326 lines

  1. /*      @(#)ev.h 20.21 93/06/28 SMI      */
  2.  
  3. /*
  4.  *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  5.  *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  6.  *    file for terms of the license.
  7.  */
  8.  
  9. #ifndef suntool_entity_view_DEFINED
  10. #define suntool_entity_view_DEFINED
  11.  
  12. /*
  13.  * This is the programmatic interface to the entity view abstraction.
  14.  *
  15.  */
  16.  
  17. #include <xview_private/portable.h>
  18.  
  19. #                ifndef pr_rop
  20. #include <pixrect/pixrect.h>
  21. #                endif
  22. #                ifndef rect_right
  23. #include <xview/rect.h>
  24. #                endif
  25. #                ifndef rl_rectoffset
  26. #include <xview/rectlist.h>
  27. #                endif
  28. #                ifndef pw_rop
  29. #include <xview/pixwin.h>
  30. #                endif
  31.  
  32. #                ifndef suntool_entity_stream_DEFINED
  33. #include <xview_private/es.h>
  34. #                endif
  35. #                ifndef suntool_entity_interpreter_DEFINED
  36. #include <xview_private/ei.h>
  37. #                endif
  38. #                ifndef suntool_finger_table_DEFINED
  39. #include <xview_private/finger_tbl.h>
  40. #                endif
  41.  
  42. #define EV_GET_INSERT(_views) (EV_CHAIN_PRIVATE(_views))->insert_pos
  43.  
  44. #define EV_SET_INSERT(_views, _position, _result)\
  45. {\
  46.        Es_handle               _esh = _views->esh;\
  47.        Ev_chain_pd_handle      _private = EV_CHAIN_PRIVATE(_views);\
  48.        _result = es_set_position(_esh, _position);\
  49.        if (_result != ES_CANNOT_SET) {\
  50.            _private->insert_pos = _result;\
  51.        }\
  52. }\
  53.  
  54. typedef ft_object    Ev_line_table;
  55.  
  56. struct first_line_info {
  57.     Es_index    line_start;
  58.     int        room_on_right;
  59. };
  60.  
  61. typedef struct ev_object *Ev_handle;
  62. struct ev_object {
  63.     Ev_handle         next;
  64.     struct ev_chain_object    *view_chain;
  65.     Xv_opaque         pw;
  66.     struct rect         rect;
  67.     struct first_line_info     first_line_info;
  68.     Ev_line_table         line_table;
  69.     Ev_line_table         tmp_line_table;
  70.     Xv_opaque         client_data;    /* Client scratch space */
  71.     caddr_t             private_data;
  72. };
  73. #define EV_NULL        (Ev_handle) 0
  74.  
  75. typedef ft_object        Ev_finger_table;
  76. struct ev_chain_object {
  77.     Es_handle        esh;
  78.     Ei_handle        eih;
  79.     Ev_handle        first_view;
  80.     Ev_finger_table        fingers;
  81.     Xv_opaque        client_data;
  82.     caddr_t            private_data;
  83. };
  84. typedef struct ev_chain_object *Ev_chain;
  85. #define EV_CHAIN_NULL    (Ev_chain_handle) 0
  86. #define EV_NO_CONTEXT    -1
  87.  
  88. #define FORNEXTVIEWS(begin_formal, view_formal)                \
  89.     for (view_formal = begin_formal->next; view_formal;        \
  90.         view_formal = view_formal->next)
  91. #define FORALLVIEWS(chain_formal, view_formal)                \
  92.     for (view_formal = chain_formal->first_view; view_formal;    \
  93.         view_formal = view_formal->next)
  94.  
  95. /* Due to compiler brain-damage, struct replaced by bit manipulation.
  96.  * Top bit is flag for "move_at_insert", and next 15 are spare.
  97.  * Lower 16 bits of Ev_mark_object are id.
  98.  */
  99. typedef long unsigned            Ev_mark_object;
  100. typedef Ev_mark_object *        Ev_mark;
  101. #define    EV_MARK_MOVE_AT_INSERT_MASK    0x80000000
  102. #define    EV_MARK_ID_MASK            0x7fffffff
  103. #define    EV_MARK_MOVE_AT_INSERT(formal)    ((formal) & EV_MARK_MOVE_AT_INSERT_MASK)
  104. #define    EV_MARK_SET_MOVE_AT_INSERT(formal)                \
  105.         (formal) |= EV_MARK_MOVE_AT_INSERT_MASK
  106. #define EV_MARK_ID(formal)        ((formal) & EV_MARK_ID_MASK)
  107. #define    EV_MARK_IS_NULL(formal)        (EV_MARK_ID(*formal) == 0)
  108. #define EV_INIT_MARK(_mark)             (_mark=0)       
  109. typedef char *            opaque_t;
  110. struct ev_finger_datum {
  111.     Es_index        pos;
  112.     Ev_mark_object        info;
  113.     opaque_t        client_data;
  114. };
  115. typedef struct ev_finger_datum *Ev_finger_handle;
  116.  
  117. /*
  118.  * Notification actions - calls are of form:
  119.  *    notify(client_data, attrs)
  120.  *        caddr_t    client_data;
  121.  *        Attr_avlist    attrs;
  122.  *
  123.  */
  124. #define EV_ATTR(type, ordinal)    ATTR(ATTR_PKG_ENTITY, type, ordinal)
  125. #define    EV_ATTR_RECT_PAIR    ATTR_TYPE(ATTR_BASE_RECT_PTR, 2)
  126. #define    EV_ATTR_REPLACE_5    ATTR_TYPE(ATTR_BASE_INT, 5)
  127. typedef enum {
  128.   EV_ACTION_VIEW    = EV_ATTR(ATTR_OPAQUE,        1),
  129.   EV_ACTION_EDIT    = EV_ATTR(EV_ATTR_REPLACE_5,    2),
  130.     /* Args are (before edit happens):
  131.      *    insert, length, start, stop_plus_one, insert_count
  132.      */
  133.   EV_ACTION_SCROLL    = EV_ATTR(EV_ATTR_RECT_PAIR,    3),
  134.     /* Args are: from_rect, to_rect */
  135.   EV_ACTION_PAINT    = EV_ATTR(ATTR_RECT_PTR,    4)
  136. } Ev_notify_action;
  137.  
  138.     /* Possible editing actions */
  139. #define EV_EDIT_BACK        0x00000001
  140. #define EV_EDIT_CHAR        0x00000002
  141. #define EV_EDIT_WORD        0x00000004
  142. #define EV_EDIT_LINE        0x00000008
  143. #define EV_EDIT_BACK_CHAR    (EV_EDIT_BACK|EV_EDIT_CHAR)
  144. #define EV_EDIT_BACK_WORD    (EV_EDIT_BACK|EV_EDIT_WORD)
  145. #define EV_EDIT_BACK_LINE    (EV_EDIT_BACK|EV_EDIT_LINE)
  146.  
  147.     /* Selection types and modes */
  148. /*
  149.  * EV_SEL_MASK is used to guarantee that EV_SEL_* flags do not occupy more
  150.  *   than 16 bits (letting clients incorporate them into 32 bit long flags,
  151.  *   which is best done by use of EV_SEL_CLIENT_FLAG).
  152.  * Currently, the code does not directly support either EV_SEL_SHELF or
  153.  *   EV_SEL_CARET, but adding them makes it easier for the clients to combine
  154.  *   the EV_SEL_* types with use of the Selection Service.
  155.  */
  156. #define EV_SEL_MASK            0xFFFF
  157. #define    EV_SEL_CLIENT_FLAG(formal)    ((formal) << 16)
  158. #define    EV_SEL_NONE            0x0000
  159. #define EV_SEL_PRIMARY            0x0001
  160. #define EV_SEL_SECONDARY        0x0002
  161. #define    EV_SEL_SHELF            0x0004
  162. #define    EV_SEL_CARET            0x0008
  163. #define EV_SEL_PD_PRIMARY        0x0010
  164. #define EV_SEL_PD_SECONDARY        0x0020
  165. #define EV_SEL_PENDING_DELETE        (EV_SEL_PD_PRIMARY)
  166. #define EV_SEL_BASE_TYPE(formal)                    \
  167.     ( (formal) &                            \
  168.       (EV_SEL_PRIMARY|EV_SEL_SECONDARY|EV_SEL_SHELF|EV_SEL_CARET) )
  169.  
  170.     /* Return values from ev_xy_in_view */
  171. #define EV_XY_VISIBLE    0
  172. #define EV_XY_ABOVE    1
  173. #define EV_XY_BELOW    2
  174. #define EV_XY_RIGHT    3
  175.  
  176.     /* Flag values for ev_find_in_esh */
  177. #define EV_FIND_DEFAULT        0
  178. #define EV_FIND_BACKWARD    1
  179. #define EV_FIND_RE        2
  180.  
  181.  
  182. /* Status values for ev_set. */
  183. typedef enum {
  184.     EV_STATUS_OKAY,
  185.     EV_STATUS_OTHER_ERROR,
  186.     EV_STATUS_BAD_ATTR,
  187.     EV_STATUS_BAD_ATTR_VALUE
  188. } Ev_status;
  189.  
  190. /* Status values for ev_expand */
  191. typedef enum {
  192.     EV_EXPAND_OKAY,
  193.     EV_EXPAND_FULL_BUF,
  194.     EV_EXPAND_OTHER_ERROR
  195. } Ev_expand_status;
  196.  
  197. #define    EV_ATTR_CARET        ATTR_TYPE(ATTR_OPAQUE, 3)
  198. /* Attributes for ev_set and ev_get. */
  199. typedef enum {
  200.     EV_CHAIN_AUTO_SCROLL_BY    = EV_ATTR(ATTR_INT,         2),
  201.     EV_CHAIN_CARET        = EV_ATTR(EV_ATTR_CARET,     6),
  202.     EV_CHAIN_CARET_IS_GHOST    = EV_ATTR(ATTR_INT,        10),
  203.     EV_CHAIN_DATA        = EV_ATTR(ATTR_OPAQUE,        14),
  204.     EV_CHAIN_DELAY_UPDATE    = EV_ATTR(ATTR_INT,        16),
  205.     EV_CHAIN_EDIT_NUMBER    = EV_ATTR(ATTR_INT,        18),
  206.     EV_CHAIN_EIH        = EV_ATTR(ATTR_OPAQUE,        22),
  207.     EV_CHAIN_ESH        = EV_ATTR(ATTR_OPAQUE,        26),
  208.     EV_CHAIN_GHOST        = EV_ATTR(EV_ATTR_CARET,    30),
  209.     EV_CHAIN_LOWER_CONTEXT    = EV_ATTR(ATTR_INT,        34),
  210.     EV_CHAIN_NOTIFY_LEVEL    = EV_ATTR(ATTR_INT,        38),
  211.     EV_CHAIN_NOTIFY_PROC    = EV_ATTR(ATTR_FUNCTION_PTR,    42),
  212.     EV_CHAIN_UPPER_CONTEXT    = EV_ATTR(ATTR_INT,        46),
  213.     EV_CLIP_RECT        = EV_ATTR(ATTR_RECT_PTR,    50),
  214.     EV_DATA            = EV_ATTR(ATTR_OPAQUE,        54),
  215.     EV_DISPLAY_START    = EV_ATTR(ATTR_INT,        58),
  216.     EV_DISPLAY_LEVEL    = EV_ATTR(ATTR_INT,        62),
  217.     EV_LEFT_MARGIN        = EV_ATTR(ATTR_INT,        66),
  218.     EV_NO_REPAINT_TIL_EVENT    = EV_ATTR(ATTR_INT,        68),
  219.     EV_RECT            = EV_ATTR(ATTR_RECT_PTR,    70),
  220.     EV_RIGHT_BREAK        = EV_ATTR(ATTR_INT,        74),
  221.     EV_RIGHT_MARGIN        = EV_ATTR(ATTR_INT,        78),
  222.     EV_SAME_AS        = EV_ATTR(ATTR_OPAQUE,        82),
  223.     EV_END_ALL_VIEWS    = EV_ATTR(ATTR_NO_VALUE,    98),
  224.     EV_FOR_ALL_VIEWS    = EV_ATTR(ATTR_NO_VALUE,    99)
  225. } Ev_attribute;
  226.  
  227. typedef enum {        /* Possible values for EV_DISPLAY_LEVEL attribute. */
  228.     EV_DISPLAY_NONE,
  229.     EV_DISPLAY_ONLY_CLEAR,
  230.     EV_DISPLAY_NO_CLEAR,
  231.     EV_DISPLAY
  232. } Ev_display_level;
  233.  
  234.             /* Flag values for EV_CHAIN_NOTIFY_LEVEL attribute. */
  235. #define    EV_NOTIFY_NONE        0x00
  236. #define    EV_NOTIFY_EDIT_DELETE    0x01
  237. #define    EV_NOTIFY_EDIT_INSERT    0x02
  238. #define    EV_NOTIFY_EDIT_ALL    (EV_NOTIFY_EDIT_DELETE|EV_NOTIFY_EDIT_INSERT)
  239. #define    EV_NOTIFY_SCROLL    0x04
  240. #define    EV_NOTIFY_REPAINT    0x08
  241. #define    EV_NOTIFY_PAINT        0x10
  242. #define    EV_NOTIFY_ALL        (EV_NOTIFY_EDIT_ALL|EV_NOTIFY_SCROLL \
  243.                 |EV_NOTIFY_REPAINT|EV_NOTIFY_PAINT)
  244.  
  245.             /* Special values for EV_DISPLAY_START */
  246. #define    EV_START_SPECIAL        0x80000000
  247. #define    EV_START_BACKWARD        0x40000000
  248. #define    EV_START_CURRENT_CONTENTS    (EV_START_SPECIAL|0x000)
  249. #define    EV_START_CURRENT_LINE        (EV_START_SPECIAL|0x001)
  250. #define    EV_START_CURRENT_POS        (EV_START_SPECIAL|0x002)
  251. #define    EV_START_NEXT_LINE        (EV_START_SPECIAL|0x010)
  252. #define    EV_START_NEXT_PAGE        (EV_START_SPECIAL|0x020)
  253. #define    EV_START_BACKWARD_LINE        (EV_START_BACKWARD|EV_START_NEXT_LINE)
  254. #define    EV_START_BACKWARD_PAGE        (EV_START_BACKWARD|EV_START_NEXT_PAGE)
  255.  
  256. typedef enum {        /* Possible values for EV_RIGHT_BREAK attribute. */
  257.     EV_CLIP,
  258.     EV_WRAP_AT_CHAR,
  259.     EV_WRAP_AT_WORD
  260. } Ev_right_break;
  261.  
  262. /* Flag values for ev_add_glyph_on_line(). */
  263. #define    EV_GLYPH_DISPLAY    0x0000001
  264. #define    EV_GLYPH_LINE_START    0x0000002
  265. #define    EV_GLYPH_WORD_START    0x0000004
  266. #define    EV_GLYPH_LINE_END    0x0000008
  267.  
  268. Pkg_private Ev_expand_status
  269. ev_expand(  /* view, start, stop_plus_one, out_buf, out_buf_len,
  270.                total_chars */  );
  271. #                            ifdef notdef
  272.     register Ev_handle     view;
  273.     Es_index         start;    /* Entity to start expanding at */
  274.     Es_index         stop_plus_one; /* 1st ent not expanded */
  275.     char            *out_buf;
  276.     int             out_buf_len;
  277.     int            *total_chars;
  278. #                            endif
  279.  
  280. Pkg_private Ev_finger_handle
  281. ev_find_finger(  /* mark */  );
  282. #                            ifdef notdef
  283.     Ev_mark_object    mark;
  284. #                            endif
  285.  
  286. /* VARARGS */
  287. Pkg_private Xv_opaque
  288. ev_get( /* view, attribute, args1, args2, args3 */ );
  289. #                            ifdef notdef
  290.     Ev_handle         view;
  291.     Ev_attribute         attribute;
  292.     caddr_t             args1, args2, args3;
  293. #                            endif
  294.  
  295. Pkg_private Es_index
  296. ev_get_insert( /* views */ );
  297. #                            ifdef notdef
  298.     Ev_chain     views;
  299. #                            endif
  300.  
  301. /* VARARGS1 */
  302. EXTERN_FUNCTION( Ev_status ev_set, (Ev_handle view, DOTDOTDOT));
  303. #                            ifdef notdef
  304.     Ev_handle       view;
  305.     va_dcl
  306. #                            endif
  307.  
  308. Pkg_private Es_index
  309. ev_set_insert( /* views, position */ );
  310. #                            ifdef notdef
  311.     Ev_chain     views;
  312.     Es_index     position;
  313. #                            endif
  314.  
  315. Pkg_private Es_index
  316. ev_scroll_lines( /* view, line_count, scroll_by_display_lines*/ );
  317. #                            ifdef notdef
  318.     Ev_handle    view;
  319.     int        line_count;
  320.     int        scroll_by_display_lines;
  321. #                            endif
  322.  
  323.  
  324. #endif
  325.  
  326.